package it.polimi.traveldream.ejb.entities;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the participation database table.
 * 
 */
@Embeddable
public class ParticipationPK implements Serializable {
	private static final long serialVersionUID = -8902003039872389216L;
	private int travelPackage;
	private int customer;

	public ParticipationPK() {
		super();
	}

	@Column(insertable=false, updatable=false)
	public int getTravelPackage() {
		return this.travelPackage;
	}
	public void setTravelPackage(int travelPackage) {
		this.travelPackage = travelPackage;
	}

	@Column(insertable=false, updatable=false)
	public int getCustomer() {
		return this.customer;
	}
	public void setCustomer(int customer) {
		this.customer = customer;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof ParticipationPK)) {
			return false;
		}
		ParticipationPK castOther = (ParticipationPK)other;
		return 
			(this.travelPackage == castOther.travelPackage)
			&& (this.customer == castOther.customer);
	}

	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.travelPackage;
		hash = hash * prime + this.customer;
		
		return hash;
	}
}